<template>  
  <div class="formDatePicker">
        <el-date-picker
          v-model="value"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          format="yyyy-MM-dd"
          @change='dateChange'>
      </el-date-picker>
    </div>
</template>

<script>
export default {
  props: {
    label: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      value: []
    }
  },
  methods: {
    dateChange() {
      let array = [];
      let obj = {}
      this.value.map(item => {
        array.push(item.dateFormat('yyyy-MM-dd'))
      })
      obj[this.label] = array;
      this.$emit('setFormData', obj)
    }
  }
}
</script>

<style lang="less" scoped>

</style>